package net.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 利用管道拷贝文件
 *
 * @author 王霄
 * @date 2021/8/21 17:48
 */
public class FileChannel_04 {

    public static void main(String[] args) throws IOException {
        //源文件
        var in = new FileInputStream("d:\\aaa.txt");
        //复制文件
        var out = new FileOutputStream("d:\\ccc.txt");

        var src = in.getChannel();

        out.getChannel().transferFrom(src, 0, src.size());
    }
}
